﻿<style>
form#contractEntranceForm .datePicker{
	margin-top:8px;
}
form#contractEntranceForm h1{
	text-align:left;
}
form#contractEntranceForm div#articles{
	float:left;
	clear:both;
}
form#contractEntranceForm{
	float:left;
	max-width:600px;
}
form#contractEntranceForm fieldset{
	float:left;
	margin-top:10px;
}
form#contractEntranceForm textarea{
	width:250px;
	float:left;
	height:120px;
	clear:both;
}
form#contractEntranceForm input, select{
	float:left;
}
form#contractEntranceForm input[type=text][disabled],
form#contractEntranceForm select[disabled]{
	background:#f5f4d1;
	color:#64635a;
	border:1px solid #c2ccb5;
}
form#contractEntranceForm input[type=radio],
form#contractEntranceForm input[type=checkbox]{
	margin:10px;
}
form#contractEntranceForm legend{
	float:left;
	margin:-10px 0px 0px 0px;
	padding:0px 5px;
	background:#ccc;
}
form#contractEntranceForm legend span{
	display:block;
	float:left;
}
form#contractEntranceForm input[type=button].remove{
	width:18px;
	height:18px;
	padding:0px;
	margin:0px 5px;
	float:left;
}
form#contractEntranceForm input#komitent_add{
	width:90px;
}
form#contractEntranceForm input.pricelist{
	width:auto;
	height:22px;
}
form#contractEntranceForm select{
	width:200px;
}
form#contractEntranceForm select option{
	width:auto;
}
form#contractEntranceForm fieldset label{
	width:40px;
}
form#contractEntranceForm span.left,
form#contractEntranceForm label{
	text-align:right;
	display:block;
	float:left;
	width:80px;
	padding-top:8px;
}
form#contractEntranceForm label.second{
	width:auto;
	margin-left:10px;
}
input#submit{
	float:left;
	clear:both;
}
span#datum{
	float:left;
	padding-top:8px;
	margin-left:5px;
	-moz-opacity:0.4;
}
h1{
	text-align:center;
}
table.contractEntranceConfirm{
	width:700px;
}
table.contractEntranceConfirm tr:hover{
	background:#fff;
}
table.contractEntranceConfirm tr:first-child td{
	background:Highlight;
	color:HighlightText;
	font-weight:bolder;
}
table.contractEntranceConfirm td{
	padding:2px 4px;
	border-right:1px solid #aaa;
	border-bottom:1px solid #aaa;
	vertical-align:top;
}
table.contractEntranceConfirm td .small{
	font-size:9px;
}
table.contractEntranceConfirm td:first-child{
	border-left:1px solid #aaa;
}
#stornoMask{
	background:#efecb3;
	-moz-opacity:0.8;
	position:relative;
}
#contractEntranceForm #ugovorVracen{
	display:none;
	float:left;
	position:relative;
	margin-top:-66px;
}
#contractEntranceForm #vracenComment{
	width:200px;
	height:50px;
	position:relative;
	margin-left:58px;
	float:left;
	clear:none;
}
</style>
<form class="area" method="get" action="javascript:void(0)" onSubmit="contractEntrance(this)" id="contractEntranceForm">
	<h1>Ulaz ugovora</h1>
	<label for="datum">Dat.Ugovora:</label>
	<input maxlength="10" rule="^\d{2}\.\d{2}\.\d{4}$" type="text" name="datum" id="datum" onclick="displayDatePicker('datum',this.nextSibling.nextSibling)" /><img class="datePicker" onClick="displayDatePicker('datum',this)" title="Odaberi datum" src="gui/icon_datepicker.gif" /><br clear="all" />
	<label for="broj_ugovora">Br.Ugovora: </label><input style="width:50px;" name="broj_ugovora" type="text" id="broj_ugovora" maxlength="10" rule="^\d{5}[\d/a-zA-Z]*$" onchange="this.value=formatUgovorBroj(this.value)" />
	<label for="kol_pracuna" class="second">Kol.Predračuna: </label><input style="width:20px;" name="kol_pracuna" type="text" id="kol_pracuna" maxlength="2" rule="^\d{1,2}$" value="0" />
	<br clear="all" />
	<label for="radnik">Radnik:</label>
	<select name="radnik" id="radnik">
		{{%loop start radnik_id}}
		<option value="{{$radnik_id}}">{{$radnik_ime}}&nbsp;{{$radnik_prezime}}</option>
		{{%loop end}}
	</select><br clear="all" />
	<label for="komitent">Komitent:</label>
	<input onBlur="var fs = document.getElementById('floatingSelect'); if(fs){fs.style.display='none'}" type="text" name="komitent" id="komitent" onKeyUp="if(event.keyCode==32){showSelect(this,'classes/fetch.php?a=komitenti&l=10','updateFloatSelect(\'komitent\',\'komitent_id\')');}" onchange="this.value = trim(this.value);" />
	<input type="hidden" name="komitent_id" id="komitent_id" value="" />
	<br clear="all" />
	<label for="kampanja">Kampanja:</label>
	<select name="kampanja" id="kampanja">
		{{%loop start kampanja_id}}
		<option value="{{$kampanja_id}}">{{$kampanja_name}}</option>
		{{%loop end}}
	</select><br clear="all" />
	<div id="articles">
	<input type="button" onclick="if(!document.getElementById('storno').checked){dodajArtikal(this)}" value="Dodaj artikal" />
	<input onChange="toggleStorno(this);" style="margin:9px 5px 0px 10px;" type="checkbox" name="storno" id="storno" value="1" /><label style="margin:0px;" for="storno" class="second">Storno</label>
	
	<input onchange="var uv=document.getElementById('ugovorVracen'); if(this.checked){uv.style.display='block';}else{uv.style.display='none';}" type="checkbox" name="vracen" id="vracen" style="margin-right:2px; margin-left:50px" value="1" /><label for="vracen" style="text-align:left; margin:0px; width:auto;">Vraćen</label>
	<span id="ugovorVracen">
	<textarea name="vracenComment" id="vracenComment">Komentar...</textarea><br clear="all" />
	<label for="vracenRadnik" class="second">radniku:</label>
	<select name="vracenRadnik" id="vracenRadnik">
		{{%loop start radnik_id}}
		<option value="{{$radnik_id}}">{{$radnik_ime}}&nbsp;{{$radnik_prezime}}</option>
		{{%loop end}} 
	</select>
	</span>
	
	<br clear="all" />
	<fieldset id="1_art">
		<legend><span>ARTIKAL 1</span> <input onClick="obrisiArtikal(this)" type="button" class="remove" value="-" title="Obriši" /></legend>
		<br clear="all" />
		<label class="second" for="artgr_all">Sve</label><input checked type="radio" name="art_grupa" id="artgr_all" value="0" onChange="updateGrps('artikl',this)" />
		{{%loop start artgr_id}}
			<label class="second" for="{{$artgr_name}}">{{$artgr_name}}</label><input type="radio" name="art_grupa" id="{{$artgr_name}}" value="{{$artgr_id}}" onChange="updateGrps('artikl',this)" />
		{{%loop end}}
		<br clear="all" />
		<label for="artikl">Ime:</label>
		<select name="artikl" id="artikl" onChange="resetTheRest(this)">
			<option value="0">---</option>
			{{%loop start art_id}}
			<option value="{{$art_id}}" title="{{$art_desc}}">{{$art_name}}</option>
			{{%loop end}}
		</select><br clear="all" />
		<label for="art_tip">Tip:</label>
		<select name="art_tip" id="art_tip" disabled>
			<option value="-1">---</option>
			{{%loop start art_tip_id}}
			<option value="{{$art_tip_id}}">{{$art_tip_name}}</option>
			{{%loop end}}
		</select><br clear="all" />
		<label for="art_boja">Boja:</label>
		<select name="art_boja" id="art_boja" disabled>
			<option value="-1">---</option>
			{{%loop start art_boja_id}}
			<option value="{{$art_boja_id}}" compare="{{$art_boja_code}}">{{$art_boja_code}}&nbsp;-&nbsp;{{$art_boja_name}}</option>
			{{%loop end}}
		</select><br clear="all" />
		<label for="art_unit">Mera</label>
		<select name="art_unit" disabled>
			<option value="-1">---</option>
			{{%loop start unit_id}}
			<option value="{{$unit_id}}" title="{{$unit_value}}">{{$unit_svalue}}</option>
			{{%loop end}}
		</select><br clear="all" />
		<div>
		<label for="art_price">Cena:</label><input rule="^\d+(\.\d+)*$" type="text" name="art_price" id="art_price" disabled />
		<input class="pricelist" type="button" onclick="loadPrice('','art_price',this)" value="cenovnik" id="price_btn" /><br clear="all" />
		<label for="non_price_list" style="padding-top:0px; " class="second">Cena van cenovnika</label>
		<input style="margin-top:0px; " type="checkbox" name="non_price_list" id="non_price_list" value="1" onChange="nonPriceList(this)" />
		</div>
		<br clear="all" />
		<label for="materijal" class="second">Ima materijal</label><input onchange="var pm = this.nextSibling.nextSibling; if(pm.style.display=='none'){pm.style.display='block'}else{pm.style.display='none'}" type="checkbox" name="materijal" id="materijal" value="1" />
		<div style="display:none;">
			<label for="potpun_materijal" class="second">materijal je potpun</label><input type="checkbox" name="potpun_materijal" id="potpun_materijal" value="1" checked="checked" />
		</div>
		<br clear="all" />
		<label for="komentar" class="second">Komentar:</label>
		<textarea name="komentar" id="komentar"></textarea><br clear="all" />
	</fieldset>
	</div>
	<input type="submit" id="submit" value="Unesi ugovor" />
</form>
<script>
setInputRules();
</script>